<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>更改密码</title>
		<link rel="stylesheet" href="__PUBLIC__/Pay/css/weui.min.css"/>
		<link rel="stylesheet" href="__PUBLIC__/Pay/css/example.css"/>
		<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
		<script src="__PUBLIC__/Pay/js/jquery-1.8.2.min.js"></script>
    	<style>
    		#container{
    			margin: 0 auto;
    			width:90%;
    			font-size: 20px;
    		}
			.weui-label{
				width: 100%;
			}
			.weui-cell_select-after .weui-select{
				padding-left:10%;
			}
    	</style>
    	<script>
    		$(function(){
                $('input[name=pwd4]').blur(function(){
                    var select2 = $('select[name=select2]').val();
                    var pwd4   = $('input[name=pwd4]').val();
                    $.post("{:U('Pay/Index/verification')}",{'select2':select2,'pwd4':pwd4},function(e){
                        if(e==1){
                            $('#dialog1').show();
                            $('#notice_message').html("您之前没有设置这个密保问题!");
                            return false;
                        }else if(e == 2){
                            $('#dialog1').show();
                            $('#notice_message').html("密保答案不对!");
                            return false;
                        }
                    })
                });
    			$('#showTooltips').bind('click',function(){
    				//1.检测密码是否为空
    				var pwd1 = $('input[name=pwd1]').val();
    				var pwd2 = $('input[name=pwd2]').val();
					var pwd4 =  $('input[name=pwd4]').val();
                                                                                        
                                                                                        
					if(pwd4==""){
						$('#dialog1').show();
    					$('#notice_message').html("密保答案不能为空!");
    					return false;
					}else if(pwd1=='' || pwd2==''){
    					$('#dialog1').show();
    					$('#notice_message').html("密码不能为空!");
    					return false;
    				}else
    				//2.检测合法性
    				var regex = /^\d{4,6}$/;
    				if(!regex.test(pwd1) || !regex.test(pwd2)){
    					$('#dialog1').show();
    					$('#notice_message').html("密码格式不符!");
    					return false;
    				}else
    				//3.检测两次密码是否相同
    				if(pwd1!=pwd2){
    					$('#dialog1').show();
    					$('#notice_message').html("两次密码不相同!");
    					return false;
    				}else{
                        var select2 = $('select[name=select2]').val();
                        var pwd4   = $('input[name=pwd4]').val();
                        $.post("{:U('Pay/Index/verification')}",{'select2':select2,'pwd4':pwd4},function(e){
                            if(e==1){
                                $('#dialog1').show();
                                $('#notice_message').html("您之前没有设置这个密保问题!");
                                return false;
                            }else if(e == 2){
                                $('#dialog1').show();
                                $('#notice_message').html("密保答案不对!");
                                return false;
                            }else{
                                $('form').trigger('submit');
                            }
                        })
					}
                                                                                        
    				
    			});
    			
    			$('#iknow').bind('click',function(){
    				$('#dialog1').hide();
    			});
                                                                   
                                                                  
    		});
    	</script>
	</head>
	<body>
		<!--提示弹层开始-->
		<div id="dialog1" style="display:none;">
			<div class="weui-mask"></div>
			<div class="weui-dialog">
				<div class="weui-dialog__hd"><strong class="weui-dialog__title">操作提示</strong></div>
				<div class="weui-dialog__bd" id="notice_message">
				</div>
				<div class="weui-dialog__ft">
					<a href="javascript:;" id="iknow" class="weui-dialog__btn weui-dialog__btn_primary">知道了</a>
				</div>
			</div>
		</div>
		</div>
		<!--提示弹层结束-->
		<div style="text-align: center;margin-top:10%;">
			<img src="__PUBLIC__/Pay/img/logo.png" width="30%" alt="中国航天" />
		</div>
		<!--主体区域开始-->
		<div id="container">
			<div class="weui-cells__title" style="text-align: center;font-size: 4vw;">重置4-6位数字查询密码</div>
			<form action="__CONTROLLER__/updatepwd" method="post">
				<div class="weui-cells">
					<div class="weui-cell weui-cell_select weui-cell_select-after">
						<div class="weui-cell__hd">
							<label for="" class="weui-label" style="font-size: 4vw;" >选择密保</label>
						</div>
						<div class="weui-cell__bd" style="font-size: 4vw;" >
							<select class="weui-select" name="select2">
								<option value="1">您喜欢的颜色</option>
								<option value="2">您配偶的生日</option>
								<option value="3">您的工号或者学号</option>
								<option value="4">您母亲的姓名</option>
								<option value="5">您父亲的姓名</option>
							</select>
						</div>
					</div>
				</div>


				<div class="weui-cells weui-cells_form">
					<div class="weui-cell weui-cell_vcode" style="padding:15px;">
						<div class="weui-cell__hd" style="width:40%;">
							<label class="weui-label" style="width:100%;margin-right:10px;font-size: 4vw;word-break:keep-all;">密保答案</label>
						</div>
						<div class="weui-cell__bd">
						</div>
						<input style="font-size: 4vw;" class="weui-input" type="text" name="pwd4" placeholder="请输入密保"/>
					</div>
				</div>


				<div class="weui-cells weui-cells_form">
					<div class="weui-cell weui-cell_vcode" style="padding:15px;">
						<div class="weui-cell__hd" style="width:40%;">
							<label class="weui-label" style="width:100%;margin-right:10px;font-size: 4vw;word-break:keep-all;">重置密码</label>
						</div>
						<div class="weui-cell__bd">
						</div>
						<input style="font-size: 4vw;" class="weui-input" type="password" name="pwd1" placeholder="请设置查看密码"/>
					</div>
				</div>
				<div class="weui-cells weui-cells_form">
					<div class="weui-cell weui-cell_vcode" style="padding:15px;">
						<div class="weui-cell__hd" style="width:40%;">
							<label class="weui-label" style="width:100%;margin-right:10px;font-size: 4vw;word-break:keep-all;">确认密码</label>
						</div>
						<div class="weui-cell__bd">
						</div>
						<input style="font-size: 4vw;" class="weui-input" type="password" name="pwd2" placeholder="请确认查看密码"/>
					</div>
				</div>
			</form>



			<div class="weui-btn-area">
			    <a style="font-size: 4vw;" class="weui-btn weui-btn_primary" href="javascript:" id="showTooltips">提交</a>
			</div>			
		</div>
		<!--主体区域结束-->
	</body>

</html>
